ng-include(src="'app/dashboard/dashboard-menu.html'")

.container.quiz-generator
	.title-section
		form(name='newQuiz')
			.form-head
				input.quiz-name(type='text', name='name', class='form-control' ng-model='quiz.name' placeholder='SURVEY NAME', ng-change='createQuizTitle()' required)
				label(for='globalTime', value='GLOBAL TIME LIMIT') Global Time Limit
				input.quiz-question-time(type='time', name='globalTime', class='form-control', placeholder='GLOBAL TIME LIMIT')
			.form-body(ng-hide="quiz.name==''")
				p.upload-image-container
					.float-left
						a.upload-image-link(href='#') UPLOAD FEATURED IMAGE
					.float-right
						p
							input.set-competition-checkbox(type='checkbox' name='set-competition-checkbox', ng-model='quiz.is_competition')
							a.set-competition-label
								label(for='set-competition-checkbox') THIS QUIZ IS A COMPETITION
						p
							input.require-login-checkbox(type='checkbox' name='require-login-checkbox' ng-model='quiz.requires_login')
							a.require-login-label
								label(for='require-login-checkbox') REQUIRE LOGIN
					.clearfix
					.another-div
				.question-row(ng-repeat='question in quiz.questions track by question.unique_id', id='question-row-{{$index}}')
					.question-options
						input.settings-checkbox(type='checkbox', name='settings-checkbox')
						label(for='settings-checkbox') USE GLOBAL TIME LIMIT
						input.question-time.form-control(type='time', name='settings-time')
						button.btn.btn-danger(value='Remove Question', data-id='{{ $index }}', ng-click='removeQuestion($event)') Remove Question
					.question-content
						input.question-input(placeholder='QUESTION {{ $index + 1}}', data-id='{{ $index }}' type='text', name='question', class='form-control', ng-model="quiz.questions[$index].name", ng-keydown='addNewQuestionToForm($event)')
						input.question-description-input(placeholder='QUESTION DESCRIPTION', type='text', name='description' class='form-control', ng-model='quiz.questions[$index].description')
					.question-answers
						.answer-input(ng-repeat='answer in quiz.questions[$index].answers track by answer.unique_id')
							input.answer-radio(ng-show='quiz.questions[$parent.$index].question_type=="quiz_single"', type='radio', name='answer-choice-{{$parent.$index}}', ng-value='true', ng-model="quiz.questions[$parent.$index].answers[$index].is_correct")						
							input.answer-checkbox(ng-show='quiz.questions[$parent.$index].question_type=="quiz_multiple"', type='checkbox', ng-model="quiz.questions[$parent.$index].answers[$index].is_correct")
							input(placeholder='ANSWER CHOICE {{ $index + 1 }}', data-id='{{ $index }}', type='text', name='answer', class='form-control', ng-model="quiz.questions[$parent.$index].answers[$index].content")
							button.btn.btn-success(value='Add', ng-click='addAnswer($event)', data-parentid='{{ $parent.$index }}') Add
							button.btn.btn-danger(value='Remove', ng-click='removeAnswer($event)', data-id='{{ $index }}', data-parentid='{{ $parent.$index }}') Remove
							br
						a(ng-click='setQuestionType($index, "quiz_multiple")', ng-show='quiz.questions[$index].question_type=="quiz_single" || quiz.questions[$index].question_type=="survey"') Allow Multiple Answers | 
						span.divider-line
						a(ng-click='setQuestionType($index, "quiz_single")', ng-show='quiz.questions[$index].question_type=="quiz_multiple" || quiz.questions[$index].question_type=="survey"') Allow Single Answer |
						span.divider-line
						a(ng-click='setQuestionType($index, "survey")', ng-show='quiz.questions[$index].question_type=="quiz_multiple" || quiz.questions[$index].question_type=="quiz_single"') Survey Question
			.form-submit
				.row.button-row
					input.btn.btn-primary.launch-button(ng-click='createNewQuiz()', type='submit', value='Save Quiz')
					input.btn.btn-primary.launch-button(ng-disabled="quiz.name==''", value='Discard Quiz')